<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        // 1. 定时器回调
        // console.log("start");
        // setTimeout(() => {
        //     console.log('定时器');
        // },0);
        // console.log('end');
        
        // 2. ajax回调
        console.log("start");
        let x = new XMLHttpRequest();
        x.open('get','https://v1.hitokoto.cn/?c=a')
        x.send();
        x.onreadystatechange = function(){
            if(x.readyState===4){
                if(x.status>=200&&x.status<300){
                    console.log(x.response);
                }
            }
        }

        console.log('end');

    </script>
</body>

</html>